<template>
  <div id="articleItem">
    <van-cell
      :to="{
        name: 'article',
        params: {
          articleId: article.art_id
        }
      }"
    >
      <div slot="title" class="article_cell van-multi-ellipsis--l2">
        {{ article.title }}
      </div>
      <div slot="label" class="label">
        <!-- 三张图片并排显示在label上面 -->
        <div v-if="article.cover.type === 3" class="covers">
          <van-image
            v-for="(img, i) in article.cover.images"
            :key="i"
            :src="img"
            class="cover"
          />
        </div>
        <span>{{ article.aut_name }}</span>
        <span>{{ article.comm_count }}评论</span>
        <span>{{ article.pubdate | timeFormat }}</span>
      </div>

      <!-- 单张图片在右侧 -->
      <van-image
        class="partRight"
        slot="default"
        v-if="article.cover.type === 1"
        :src="article.cover.images[0]"
      />
    </van-cell>
  </div>
</template>

<script>
// 单页面组件
export default {
  name: 'articleItem',
  props: {
    article: {
      type: Object,
      required: true
    }
  },
  data() {
    return {}
  },
  methods: {},
  computed: {},
  created() {
    // console.log(this.article)
  },
  components: {}
}
</script>

<style lang="less" scoped>
.article_cell {
  font-size: 32px;
  color: #3a3a3a;
}
.label {
  margin-top: 50px;
  span {
    font-size: 23px;
    color: #b4b4b4;
    margin-right: 23px;
  }
  .covers {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 30px 0;
    .cover {
      width: 232px;
      height: 146px;
      &:not(:last-child) {
        padding-right: 4px;
      }
      img {
        flex: 1;
        width: 232px;
        height: 146px;
      }
    }
  }
}
.van-cell__value {
  flex: unset;
  width: 232px;
  height: 146px;
  padding-left: 25px;
  .partRight {
    width: 232px;
    height: 146px;
  }
}
</style>
